import { defineComponent, ref } from 'vue';
import { Cell, CellGroup } from 'vant';
import { getLocal, setLocal } from '../../utils/cache';
import { useRouter } from 'vue-router';
import { showNotify } from 'vant';

export default defineComponent({
    name: 'mine',
    setup(props, { slots }) {
        // Your script setup code here
        let value = ref('0');
        let router = useRouter();
        let username = ref(getLocal('username'));
        console.log(username, 'username');
        return () => (
            <div class={'bg-white rounded-lg'}>
                {/* Your Dom code here */}
                <CellGroup inset>
                    <Cell title="昵称" value={username.value}></Cell>
                    {/* <Cell title="电话" value="15285401883"></Cell> */}
                    <Cell title="个性签名" value="我这一生放荡不羁爱自由"></Cell>
                    <Cell title="密码" value="******"></Cell>
                </CellGroup>
                <ButtonGroup>
                    <Button
                        class="flex-1"
                        size="lg"
                        type="primary"
                        onclick={() => {
                            setLocal('token', null);
                            showNotify({ type: 'success', message: `退出成功` });
                            router.push('/login');
                        }}
                    >
                        退出登录
                    </Button>
                </ButtonGroup>
            </div>
        );
    },
});
